<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>钢链网-订单详情</title>
	<link rel="stylesheet" href="/resource/css/gl_index.css">
	<link rel="stylesheet" href="/resource/css/gl_user.css">
	<link rel="stylesheet" href="/resource/css/gl_showBo.css">

	<script src="/resource/js/jquery-1.11.3.min.js"></script>
	<script src="/resource/js/gl_index.js"></script>
	<script src="/resource/js/gl_showBo.js"></script>
	<script>
		$(function(){
			//点击确认提货
			var popup = '<div class="popup"></div><div class="popup-show">';
		        popup += '<div class=\"popup-p\">';
		        popup +='<i><img src=\"./resource/img/gl_show_succ.png\" alt=""></i>';
		        popup +='<div class=\"left\">';           
		        popup +='请确认您已经收到货，确认后可申请开票<br/>';                 
		        popup +='<div class="btn"><a href="javascript:;" class="deter">确定</a>';
		        popup +='<a href="javascript:;" class="close">取消</a></div>';                 
		        popup +='</div><div class=\"popup-close\"></div></div></div>'; 
		    $('body').append(popup); 
		    $('.popup-show').css('margin-left',-$('.popup-show').width()/2);
		    
		    $(document).delegate('.confirm','click',function(){
		    	$('.popup-show').show();
		    	$('.popup').show();
		    });
		    $(document).delegate('.popup-show .deter','click',function(){
				var order_id =$("#order_id").val();
				$.ajax({
					url : '/confirm_receipt',
					type : "POST",
					data : {order_id:order_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if (json){
							location=location
						}
					}
				});

			});

		    //开票

		    $('input.form-control').after('<span>11</span>');
		    $('input.form-control').blur(function(){
		    	if(!$(this).val()){
		    		$(this).siblings('span').show().html('不能为空');
		    	}else{
		    		$(this).siblings('span').hide();
		    	}
		    });
		    $('.btn-billing').click(function(){
				var bill = [];
				var order_id =$("#order_id").val();
				console.log(order_id);
				console.log(bill);
				for (var i = 0; i < $('input.form-control').length; i++) {
					if(!$('input.form-control').eq(i).val()){
						$('input.form-control').eq(i).focus().siblings('span').show().html('不能为空');
						return false;
					}else{
						bill.push($('input.form-control').eq(i).val());
					}
				};
		    	$('.popup-billing').hide();
       			$('.popup').hide();
				$.ajax({
					url : '/add_invoice',
					type : "POST",
					data : {order_id:order_id,title:bill[0],address:bill[1],addressee:bill[2],phone:bill[3]},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						Showbo.Msg.nameauth('<img src="/resource/img/gl_show_succ.png" style="margin-top:20px;"><div style="font-size:24px;">已确认开票</div><div style="margin-bottom:25px;line-height:38px;font-size:14px;color:#656464;">开票完成后，我们会尽快将发票寄到您的手中</div>',function(){
							location=location
						});
					}
				});
		    	//Showbo.Msg.alert('<img src="/resource/img/gl_show_succ.png" style="margin-top:20px;"><div style="font-size:24px;">已确认开票</div><div style="margin-bottom:25px;line-height:38px;font-size:14px;color:#656464;">开票完成后，我们会尽快将发票寄到您的手中</div>');
		    });

		});
	</script>
</head>
<body>
<div class="head">
	@include('common.user_head')
</div>
<div class="user-head">
	<div class="main">
		<div class="logo">
			<a href="/"><img src="/resource/img/logo.png" alt=""></a>
			<div>我的钢链网
				<a href="/">返回首页</a>
			</div>
		</div>
	</div>
</div>	
<div class="user main">
	@include('common.user_menu')
	<div class="user-cont">
		<div class="order-details">
			<!-- 等待付款 -->
			<!-- <div class="details">
				<div class="title">
					<div class="in"><span class="til">等待付款</span></div>
					<div class="btn-box"><span>您可以</span><a href="javascript:;">立即付款</a></div>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th width="170px">商品编号</th>
								<th width="170px">品名</th>
								<th width="90px">材质</th>
								<th width="160px">规格</th>
								<th width="80px">数量</th>
								<th width="">价格（元\吨）</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>15689809878</td>
								<td>线材</td>
								<td>RHB400</td>
								<td>RHB400</td>
								<td>5</td>
								<td><span>￥1700.00</span></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="money-info">商品总计：<span>￥1700.00</span></div>
				<div class="order-info">
					<table>
						<thead>
							<tr>
								<th width="125px"></th>
								<th width=""></th>
							</tr>
						</thead>
						<tbody>
							<tr class="til">
								<td colspan="2">订单信息</td>
							</tr>
							<tr>
								<td>支付方式</td>
								<td>现金支付</td>
							</tr>
							<tr>
								<td>件 &#160; &#160; 数</td>
								<td>5件</td>
							</tr>
							<tr>
								<td>实&#160;付&#160;款</td>
								<td>￥55666.00</td>
							</tr>
							<tr>
								<td>提货仓库</td>
								<td>北京石岗厂</td>
							</tr>
							<tr>
								<td>仓库地址</td>
								<td>北京市朝阳区58号</td>
							</tr>
							<tr>
								<td>联系电话</td>
								<td>18332598996</td>
							</tr>
							<tr>
								<td>订单编号</td>
								<td>455599990087742</td>
							</tr>
							<tr>
								<td>下单时间</td>
								<td>2016-02-15   15：21</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div> -->
			<!-- 交易成功 -->
			<!-- <div class="details">
				<div class="title">
					<div class="in"><span class="til til-succ">交易成功</span></div>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th width="170px">商品编号</th>
								<th width="170px">品名</th>
								<th width="90px">材质</th>
								<th width="160px">规格</th>
								<th width="80px">数量</th>
								<th width="">价格（元\吨）</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>15689809878</td>
								<td>线材</td>
								<td>RHB400</td>
								<td>RHB400</td>
								<td>5</td>
								<td><span>￥1700.00</span></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="money-info">商品总计：<span>￥1700.00</span></div>
				<div class="order-info">
					<table>
						<thead>
							<tr>
								<th width="125px"></th>
								<th width=""></th>
							</tr>
						</thead>
						<tbody>
							<tr class="til">
								<td colspan="2">订单信息</td>
							</tr>
							<tr>
								<td>支付方式</td>
								<td>现金支付</td>
							</tr>
							<tr>
								<td>件 &#160; &#160; 数</td>
								<td>5件</td>
							</tr>
							<tr>
								<td>实&#160;付&#160;款</td>
								<td>￥55666.00</td>
							</tr>
							<tr>
								<td>提货仓库</td>
								<td>北京石岗厂</td>
							</tr>
							<tr>
								<td>仓库地址</td>
								<td>北京市朝阳区58号</td>
							</tr>
							<tr>
								<td>联系电话</td>
								<td>18332598996</td>
							</tr>
							<tr>
								<td>订单编号</td>
								<td>455599990087742</td>
							</tr>
							<tr>
								<td>下单时间</td>
								<td>2016-02-15   15：21</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div> -->
			<!-- 等待审核 -->
			<!-- <div class="details">
				<div class="title">
					<div class="in"><span class="til">等待审核</span></div>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th width="170px">商品编号</th>
								<th width="170px">品名</th>
								<th width="90px">材质</th>
								<th width="160px">规格</th>
								<th width="80px">数量</th>
								<th width="">价格（元\吨）</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>15689809878</td>
								<td>线材</td>
								<td>RHB400</td>
								<td>RHB400</td>
								<td>5</td>
								<td><span>￥1700.00</span></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="money-info">商品总计：<span>￥1700.00</span></div>
				<div class="order-info">
					<table>
						<thead>
							<tr>
								<th width="125px"></th>
								<th width=""></th>
							</tr>
						</thead>
						<tbody>
							<tr class="til">
								<td colspan="2">订单信息</td>
							</tr>
							<tr>
								<td>支付方式</td>
								<td>现金支付</td>
							</tr>
							<tr>
								<td>件 &#160; &#160; 数</td>
								<td>5件</td>
							</tr>
							<tr>
								<td>实&#160;付&#160;款</td>
								<td>￥55666.00</td>
							</tr>
							<tr>
								<td>提货仓库</td>
								<td>北京石岗厂</td>
							</tr>
							<tr>
								<td>仓库地址</td>
								<td>北京市朝阳区58号</td>
							</tr>
							<tr>
								<td>联系电话</td>
								<td>18332598996</td>
							</tr>
							<tr>
								<td>订单编号</td>
								<td>455599990087742</td>
							</tr>
							<tr>
								<td>下单时间</td>
								<td>2016-02-15   15：21</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div> -->
			<!-- 等待提货 -->
			<!-- <div class="details">
				<div class="title">
					<div class="in"><span class="til">等待提货</div>
					<div class="btn-box"><span>您可以</span><a href="javascript:;" class="confirm">确认提货</a></div>
				</div>
				<div class="table">
					<table>
						<thead>
							<tr>
								<th width="170px">商品编号</th>
								<th width="170px">品名</th>
								<th width="90px">材质</th>
								<th width="160px">规格</th>
								<th width="80px">数量</th>
								<th width="">价格（元\吨）</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>15689809878</td>
								<td>线材</td>
								<td>RHB400</td>
								<td>RHB400</td>
								<td>5</td>
								<td><span>￥1700.00</span></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="money-info">商品总计：<span>￥1700.00</span></div>
				<div class="order-info">
					<table>
						<thead>
							<tr>
								<th width="125px"></th>
								<th width=""></th>
							</tr>
						</thead>
						<tbody>
							<tr class="til">
								<td colspan="2">订单信息</td>
							</tr>
							<tr>
								<td>支付方式</td>
								<td>现金支付</td>
							</tr>
							<tr>
								<td>件 &#160; &#160; 数</td>
								<td>5件</td>
							</tr>
							<tr>
								<td>实&#160;付&#160;款</td>
								<td>￥55666.00</td>
							</tr>
							<tr>
								<td>提货仓库</td>
								<td>北京石岗厂</td>
							</tr>
							<tr>
								<td>仓库地址</td>
								<td>北京市朝阳区58号</td>
							</tr>
							<tr>
								<td>联系电话</td>
								<td>18332598996</td>
							</tr>
							<tr>
								<td>订单编号</td>
								<td>455599990087742</td>
							</tr>
							<tr>
								<td>下单时间</td>
								<td>2016-02-15   15：21</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div> -->
			<!-- 等待开票 -->
			<div class="details">
				<input type="hidden" id="order_id" value="{{$data->order_id}}">
				@if($data->order_status == 10)
					<div class="title">
						<div class="in"><span class="til">等待审核</span></div>
					</div>
				@elseif($data->order_status == 20)
					<div class="title">
						<div class="in"><span class="til">等待付款</span></div>
						<div class="btn-box"><span>您可以</span><a href="javascript:;">立即付款</a></div>
					</div>
				@elseif($data->order_status == 30)
					<div class="title">
						<div class="in"><span class="til">等待提货</div>
						<div class="btn-box"><span>您可以</span><a href="javascript:;" class="confirm">确认提货</a></div>
					</div>
				@elseif($data->order_status == 40)
					<div class="title">
						<div class="in"><span class="til">等待开票</div>
						<div class="btn-box"><span>您可以</span><a href="javascript:;" class="billing">立即开票</a></div>
					</div>
				@elseif($data->order_status == 50)
					<div class="title">
						<div class="in"><span class="til til-succ">交易成功</span></div>
					</div>
				@endif

				<div class="table">
					<table>
						<thead>
							<tr>
								<th width="170px">商品编号</th>
								<th width="170px">品名</th>
								<th width="90px">材质</th>
								<th width="160px">规格</th>
								<th width="80px">数量</th>
								<th width="">价格（元\吨）</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>{{$data->product_sn}}</td>
								<td>{{$data->brand_name}}</td>
								<td>{{$data->m_name}}</td>
								<td>{{$data->product_spec}}</td>
								<td>{{$data->number}}</td>
								<td><span>{{$data->product_price}}</span></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="money-info">商品总计：<span>{{$data->amount}}</span></div>
				<div class="order-info">
					<table>
						<thead>
							<tr>
								<th width="125px"></th>
								<th width=""></th>
							</tr>
						</thead>
						<tbody>
							<tr class="til">
								<td colspan="2">订单信息</td>
							</tr>
							<tr>
								<td>支付方式</td>
									@if($data->payment_id == 0)
									<td>京东在线支付</td>
									@elseif($data->payment_id == 1)
									<td>现金支付</td>
									@elseif($data->payment_id == 2)
									<td>银行汇款</td>
									@elseif($data->payment_id == 3)
									<td>银行承兑汇票</td>
									@endif

							</tr>
							<tr>
								<td>件 &#160; &#160; 数</td>
								<td>{{$data->number}}</td>
							</tr>
							<tr>
								<td>实&#160;付&#160;款</td>
								<td>￥{{$data->amount}}</td>
							</tr>
							<tr>
								<td>提货仓库</td>
								<td>{{$data->factory_name}}</td>
							</tr>
							<tr>
								<td>仓库地址</td>
								<td>{{$data->storage_address}}</td>
							</tr>
							<tr>
								<td>联系电话</td>
								<td>{{$data->storage_phone}}</td>
							</tr>
							<tr>
								<td>订单编号</td>
								<td>{{$data->order_sn}}</td>
							</tr>
							<tr>
								<td>下单时间</td>
								<td>{{date("Y-m-d H:i:s", $data->order_time)}}</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 立即开票弹窗 -->
<div class="popup-billing">
	<form action="">
		<div class="title">
			填写发票信息
			<div class="close"></div>
		</div>
		<div class="form">
			<div class="form-group">
				<label for="">公司抬头：</label>
				<input type="text" class="form-control">
			</div>
			<div class="form-group">
				<label for="">邮寄地址：</label>
				<input type="text" class="form-control">
			</div>
			<div class="form-group">
				<label for="">联 系 人：</label>
				<input type="text" class="form-control">
			</div>
			<div class="form-group">
				<label for="">联系电话：</label>
				<input type="text" class="form-control">
			</div>
			<input type="button" class="btn-billing" value="确认开票">
		</div>
	</form>
</div>
@include('common.shop_foot')
</body>
</html>